package com.qupeng.demo.kafka.kafkaspringbootproducer.producer;

import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;

public final class RandomNumberGenerator {
    private RandomNumberGenerator() {
    }

    public static int getRandom(final int bound) {
        SecureRandom secureRandom = null;
        try {
            secureRandom = SecureRandom.getInstanceStrong();
        } catch (NoSuchAlgorithmException e) {
            secureRandom = new SecureRandom();
        }
        return secureRandom.nextInt(bound);
    }
}
